package com.hziee.graduate.ticket.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hziee.graduate.ticket.dto.R;
import com.hziee.graduate.ticket.entity.Room;
import com.hziee.graduate.ticket.entity.User;
import com.hziee.graduate.ticket.service.RoomService;
import com.hziee.graduate.ticket.vo.RoomVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("room")
public class RoomController {

    @Resource
    private RoomService roomService;

    @PostMapping("/addARoom")
    public R<Object> addARoom(@RequestBody Map<String,Object> map) {
        return roomService.addARoom(map);
    }

    @PostMapping("/updateARoom")
    public R<Object> updateARoom(@RequestBody Map<String,Object> map) {
        return roomService.updateARoom(map);
    }

    @GetMapping("/deleteARoom/{roomId}")
    public R<Object> deleteARoom(@PathVariable Long roomId) {
        return roomService.deleteARoom(roomId);
    }

    @GetMapping("/getAllRoomByCinema/{cinemaId}")
    public R<List<Room>> getAllRoomByCinema(@PathVariable Long cinemaId) {
        return roomService.getAllRoomByCinema(cinemaId);
    }

    @GetMapping("/getAvailableRoomsByCinema/{cinemaId}")
    public R<List<Room>> getAvailableRoomsByCinema(@PathVariable Long cinemaId) {
        return roomService.getAvailableRoomsByCinema(cinemaId);
    }

    @GetMapping("/getRoomBySchedule/{movieId}/{date}/{cinemaId}/{scheduleId}")
    public R<RoomVO> getRoomBySchedule(@PathVariable Long movieId, @PathVariable Long cinemaId, @PathVariable String date, @PathVariable Long scheduleId) {
        return roomService.getRoomBySchedule(movieId,date,cinemaId,scheduleId);
    }

    @GetMapping("/updateRoomOpenStatusById/{roomId}")
    public R<Object> updateRoomOpenStatusById(@PathVariable Long roomId) {
        return roomService.updateRoomOpenStatusById(roomId);
    }

}

